<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="ThemeBucket">
    <link rel="shortcut icon" href="#" type="image/png">
    
    <title>Form Layouts</title>
    
    <?php $this->load->view('library/header');?>
</head>

<body class="sticky-header">

<section>
    <?php $this->load->view('library/left');?>
    <div class="main-content" >
        <?php $this->load->view('library/top');?>
        <div class="page-heading">
            <h3>
                搜图
            </h3>
            <ul class="breadcrumb">
                <li>
                    <a href="#">Forms</a>
                </li>
                <li class="active"> Forms Layouts </li>
            </ul>
        </div>
        <section class="wrapper">
            <div class="row">
                <div class="col-lg-12">
                    <form id="uploadForm" enctype="multipart/form-data"  class="form-horizontal adminex-form">
                    <section class="panel">
                        <div class="panel-body">
                            
                            <div class="form-group">
                                <label class="col-sm-2 col-sm-2 control-label">图片</label>
                                <div class="col-sm-10">
                                    <input type="file" name="file_pcs" id="pic_img">
                                </div>
                            </div>
                            <div class="form-group">
                                <label class="col-lg-2 col-sm-2 control-label"></label>
                                <div class="col-lg-10">
                                    <!-- <a href="#">4444</a> -->
                                    <input type="submit" onclick="upload();" class="btn btn-primary" value="Submit">
                                    <img id="img_1" style="width:50;height: 50px;" src="" alt="">
                                </div>
                            </div>
                        </div>
                    </section>
                    </form>
                </div>
            </div>
            <div id="img">
            </div>
        </section>
        <footer>
            2014 &copy; AdminEx by
        </footer>
    </div>
</section>
<?php $this->load->view('library/footer');?>
<script src="/public/js/scripts.js"></script>
<script>
    $("#uploadForm").submit(function(){

        var formData = new FormData($("#uploadForm")[0])
        $.ajax({
            url: "<?php echo base_url('product/search_map');?>",
            data: formData,
            type: "POST",
            async: false,
            cache: false,
            contentType: false,
            processData: false,
            dataType:'json',
            success: function(Object) {
                var html = '';
                $.each(Object.img, function(k, v) {
                    html += '<img src="'+v+'" style="margin-top: 5px;margin-left: 5px" width="200px" height="200px" alt="">';
                })
                $('#img_1').attr('src',Object.img_1);
                $('#img').html(html);
            },
            
        })

        
        return false;
    });
</script>
</body>
</html>